﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package mochicrypt.as3 {
    import flash.display.*;

    public class MochiEvents {

        public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
        public static const FORMAT_LONG:String = "LongForm";
        public static const ALIGN_BOTTOM:String = "ALIGN_B";
        public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
        public static const FORMAT_SHORT:String = "ShortForm";
        public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
        public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
        public static const ALIGN_TOP:String = "ALIGN_T";
        public static const ALIGN_LEFT:String = "ALIGN_L";
        public static const ALIGN_RIGHT:String = "ALIGN_R";
        public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
        public static const ALIGN_CENTER:String = "ALIGN_C";

        private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
        private static var gameStart:Number;
        private static var levelStart:Number;

        public static function addEventListener(_arg1:String, _arg2:Function):void{
            _dispatcher.addEventListener(_arg1, _arg2);
        }
        public static function removeEventListener(_arg1:String, _arg2:Function):void{
            _dispatcher.removeEventListener(_arg1, _arg2);
        }
        public static function startSession(_arg1:String):void{
            MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
        }
        public static function triggerEvent(_arg1:String, _arg2:Object):void{
            _dispatcher.triggerEvent(_arg1, _arg2);
        }
        public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
            var _local4:Object;
            var _local3:Object = {};
            for (_local4 in _arg2) {
                _local3[_local4] = _arg2[_local4];
            };
            _local3.clip = _arg1;
            MochiServices.send("events_setNotifications", _local3, null, null);
        }
        public static function endGame():void{
            var _local1:Number = (new Date().time - gameStart);
            trigger("end_game", {time:_local1});
        }
        public static function startGame():void{
            gameStart = new Date().time;
            trigger("start_game");
        }
        public static function trigger(_arg1:String, _arg2:Object=null):void{
            if (_arg2 == null){
                _arg2 = {};
            } else {
                if (_arg2["kind"] != undefined){
                    trace("WARNING: optional arguments package contains key 'id', it will be overwritten");
                    _arg2["kind"] = _arg1;
                };
            };
            MochiServices.send("events_triggerEvent", {eventObject:_arg2}, null, null);
        }
        public static function getVersion():String{
            return (MochiServices.getVersion());
        }
        public static function startLevel():void{
            levelStart = new Date().time;
            trigger("start_level");
        }
        public static function endLevel():void{
            var _local1:Number = (new Date().time - levelStart);
            trigger("end_level", {time:_local1});
        }

    }
}//package mochicrypt.as3 
